package edu.ynu.se.xiecheng.achitectureclass.controller;

import edu.ynu.se.xiecheng.achitectureclass.dto.DataDTO;
import edu.ynu.se.xiecheng.achitectureclass.service.CO2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/CO2")
public class CO2Controller {
    @Autowired
    private CO2Service co2Service;

    @GetMapping("/tenCO2data")
    public List<DataDTO> getCO2Data() {
        return co2Service.findLatestTenCO2Data();
    }
}
